\hypertarget{mcpwm_8h}{}\section{mcpwm.\+h File Reference}
\label{mcpwm_8h}\index{mcpwm.\+h@{mcpwm.\+h}}
{\ttfamily \#include \char`\"{}conf\+\_\+general.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}datatypes.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdbool.\+h$>$}\\*
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{mcpwm_8h_a0d1206613a23135d2ad67c961fcd86a8}{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N}~3000
\item 
\#define \hyperlink{mcpwm_8h_a220210c9d8362e1006daacf083302ac6}{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X}~40000
\item 
\#define \hyperlink{mcpwm_8h_a1d7cc0d242a219aeefb8197fc4d6bbb1}{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R}~25000
\item 
\#define \hyperlink{mcpwm_8h_af326efcbabf49b6657bdc53d4ebbf8a6}{M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S}~100
\item 
\#define \hyperlink{mcpwm_8h_a9a916c035a72adb2b996c1c67250a867}{M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q}~1000000.\+0
\item 
\#define \hyperlink{mcpwm_8h_a9fe34dbe691b4ee69ea087e40323c38c}{M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}~0
\item 
\#define \hyperlink{mcpwm_8h_a2b488809f7755e1f611e6f0635685c6d}{M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}~500
\item 
\#define \hyperlink{mcpwm_8h_aab2f67a9864fe0d38361b1a2264c4e3c}{M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K}~0.\+001
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{mcpwm_8h_a741df16681b89fa88b1dfdc148e9c247}{mcpwm\+\_\+init} (\hyperlink{structmc__configuration}{mc\+\_\+configuration} $\ast$configuration)
\item 
const volatile \hyperlink{structmc__configuration}{mc\+\_\+configuration} $\ast$ \hyperlink{mcpwm_8h_a6a5d94aa8dfe85c2e2eb8bcedc4cc9e2}{mcpwm\+\_\+get\+\_\+configuration} (void)
\item 
void \hyperlink{mcpwm_8h_af0c84721a6bd9e03bcdc83997dceb0bd}{mcpwm\+\_\+set\+\_\+configuration} (\hyperlink{structmc__configuration}{mc\+\_\+configuration} $\ast$configuration)
\item 
void \hyperlink{mcpwm_8h_ab0ded721a702fcc2f419e348dfb2394e}{mcpwm\+\_\+init\+\_\+hall\+\_\+table} (int8\+\_\+t $\ast$table)
\item 
void \hyperlink{mcpwm_8h_a9dd57224b5a0906f51f63deb04575fda}{mcpwm\+\_\+set\+\_\+duty} (float duty\+Cycle)
\item 
void \hyperlink{mcpwm_8h_ac0ea3c433002e0c6152f1e8c336ea773}{mcpwm\+\_\+set\+\_\+pid\+\_\+speed} (float rpm)
\item 
void \hyperlink{mcpwm_8h_a947be2c19679b5d18b593fd43b3bbc5f}{mcpwm\+\_\+set\+\_\+pid\+\_\+pos} (float pos)
\item 
void \hyperlink{mcpwm_8h_ac8cce9e7089ba5b002f4bf38211ed27a}{mcpwm\+\_\+set\+\_\+current} (float current)
\item 
void \hyperlink{mcpwm_8h_af5a0f5ec4944da39e9192d1fee78c5ad}{mcpwm\+\_\+set\+\_\+brake\+\_\+current} (float current)
\item 
void \hyperlink{mcpwm_8h_a059e73c08f17b8f9c0f367903f9d5c0b}{mcpwm\+\_\+brake\+\_\+now} (void)
\item 
void \hyperlink{mcpwm_8h_a060e6f8cceedc217d4cda3dc7e255acb}{mcpwm\+\_\+release\+\_\+motor} (void)
\item 
void \hyperlink{mcpwm_8h_a950110bbb0c5db30530775f3ad8c7c8f}{mcpwm\+\_\+lock} (void)
\item 
void \hyperlink{mcpwm_8h_a9833abbb75ecaec36ea2f2ae6afa14e3}{mcpwm\+\_\+unlock} (void)
\item 
void \hyperlink{mcpwm_8h_a01ee78893a848db2a0a265d85516d89d}{mcpwm\+\_\+lock\+\_\+override\+\_\+once} (void)
\item 
int \hyperlink{mcpwm_8h_ad2acaf5174aa1f04744dd0b2355cfe9c}{mcpwm\+\_\+get\+\_\+comm\+\_\+step} (void)
\item 
float \hyperlink{mcpwm_8h_abf9e2e82ba6197cccca4980be9d82e86}{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set} (void)
\item 
float \hyperlink{mcpwm_8h_a055e8c23ee46051aa3e9c8eb5a62da31}{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now} (void)
\item 
float \hyperlink{mcpwm_8h_a2c11fd7cd576b8545639d70ad9068bb6}{mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now} (void)
\item 
float \hyperlink{mcpwm_8h_aa48e2f10a4519f28a8cedf114ddd39fa}{mcpwm\+\_\+get\+\_\+rpm} (void)
\item 
\hyperlink{datatypes_8h_a31ba5ae9b4a53237b5b76db71ca0299a}{mc\+\_\+state} \hyperlink{mcpwm_8h_a877cbb1f32dab9cc76d8aad64b2aa1ed}{mcpwm\+\_\+get\+\_\+state} (void)
\item 
\hyperlink{datatypes_8h_a29724157fc2c874a0bafeb059b571d14}{mc\+\_\+fault\+\_\+code} \hyperlink{mcpwm_8h_a543e86f6faec79974352738009a9da40}{mcpwm\+\_\+get\+\_\+fault} (void)
\item 
const char $\ast$ \hyperlink{mcpwm_8h_a7795f8c26fddcf448afa3d25623ae4e9}{mcpwm\+\_\+fault\+\_\+to\+\_\+string} (\hyperlink{datatypes_8h_a29724157fc2c874a0bafeb059b571d14}{mc\+\_\+fault\+\_\+code} fault)
\item 
float \hyperlink{mcpwm_8h_a2755a29a5e5899b14bf3a8885cee5fad}{mcpwm\+\_\+get\+\_\+kv} (void)
\item 
float \hyperlink{mcpwm_8h_a381642f17c64e43bc0d1ee711dcf65eb}{mcpwm\+\_\+get\+\_\+kv\+\_\+filtered} (void)
\item 
int \hyperlink{mcpwm_8h_a095a677c5faec19ad0e58cf18a371c1f}{mcpwm\+\_\+get\+\_\+tachometer\+\_\+value} (bool reset)
\item 
int \hyperlink{mcpwm_8h_a669cef28cf150b9bb377db52bf38f3aa}{mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value} (bool reset)
\item 
float \hyperlink{mcpwm_8h_a2e52e42e3bf9eb9b3a6c20e234c35dd3}{mcpwm\+\_\+get\+\_\+amp\+\_\+hours} (bool reset)
\item 
float \hyperlink{mcpwm_8h_ab6138c5d1ee524398afef60eb74b6572}{mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged} (bool reset)
\item 
float \hyperlink{mcpwm_8h_a6528d34554fe5f88bac0a7c04c26d6f8}{mcpwm\+\_\+get\+\_\+watt\+\_\+hours} (bool reset)
\item 
float \hyperlink{mcpwm_8h_a0a8f41dcfa397ba1197e9cd139f391b4}{mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged} (bool reset)
\item 
float \hyperlink{mcpwm_8h_a62cdbf8a4a38b8537d93c6bd1c01b91e}{mcpwm\+\_\+get\+\_\+tot\+\_\+current} (void)
\item 
float \hyperlink{mcpwm_8h_a15bd545876cc438ccafe772971305f18}{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered} (void)
\item 
float \hyperlink{mcpwm_8h_ac0b77e746e9a92a419d6114997fbd763}{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional} (void)
\item 
float \hyperlink{mcpwm_8h_a2a2c6e557a045f7e70a177aeb9e6268b}{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered} (void)
\item 
float \hyperlink{mcpwm_8h_a5a07d303d2dbeeb7d406031ec0245768}{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in} (void)
\item 
float \hyperlink{mcpwm_8h_a632b1e9f636f0e2dae31ae45704ad5ce}{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered} (void)
\item 
void \hyperlink{mcpwm_8h_aee80954eb251a3cc7e3cbd9e2d72ad50}{mcpwm\+\_\+set\+\_\+detect} (void)
\item 
float \hyperlink{mcpwm_8h_a75eba9ba5161ac581ad23fe0718de72e}{mcpwm\+\_\+get\+\_\+detect\+\_\+pos} (void)
\item 
void \hyperlink{mcpwm_8h_a811f97662c12f6c6f6db2d3ef653317e}{mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table} (void)
\item 
int \hyperlink{mcpwm_8h_aa5c97caf8a3c2a33986a77a39d32f88f}{mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result} (int8\+\_\+t $\ast$table)
\item 
int \hyperlink{mcpwm_8h_af3c4d35168fdd37ace78e17350785ff9}{mcpwm\+\_\+read\+\_\+hall\+\_\+phase} (void)
\item 
float \hyperlink{mcpwm_8h_af291b09431a336394d37f9faeca78263}{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current} (void)
\item 
float \hyperlink{mcpwm_8h_a6e658badc7694a6fd3b20c66b42efeb8}{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current} (void)
\item 
float \hyperlink{mcpwm_8h_aecc8d955f57997ec6ddb37d9923c1030}{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator} (void)
\item 
void \hyperlink{mcpwm_8h_a56298b9a210017fcdf9eb982de492a80}{mcpwm\+\_\+set\+\_\+min\+\_\+rpm} (float rpm)
\item 
float \hyperlink{mcpwm_8h_a40f44eb9a9076013bedd753a31e8ca01}{mcpwm\+\_\+get\+\_\+min\+\_\+rpm} (void)
\item 
void \hyperlink{mcpwm_8h_adf1422a651e069f04434c76fd359f5d7}{mcpwm\+\_\+set\+\_\+comm\+\_\+mode} (\hyperlink{datatypes_8h_af3916564ec22a69f58dea8b020011381}{mc\+\_\+comm\+\_\+mode} mode)
\item 
\hyperlink{datatypes_8h_af3916564ec22a69f58dea8b020011381}{mc\+\_\+comm\+\_\+mode} \hyperlink{mcpwm_8h_a7ebe7d5c7ed7ac5f336aab186a23377f}{mcpwm\+\_\+get\+\_\+comm\+\_\+mode} (void)
\item 
float \hyperlink{mcpwm_8h_ad04a5f41ac3b2dbdff88e925f5a7c867}{mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration} (void)
\item 
float \hyperlink{mcpwm_8h_afbf59470d2a43800159793dcf9a2fa1c}{mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration} (void)
\item 
\hyperlink{structmc__rpm__dep__struct}{mc\+\_\+rpm\+\_\+dep\+\_\+struct} \hyperlink{mcpwm_8h_a3e00de142622d9a94d6ff0711850c0e9}{mcpwm\+\_\+get\+\_\+rpm\+\_\+dep} (void)
\item 
void \hyperlink{mcpwm_8h_a472294b4fc68a52694b3b2751a473b96}{mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler} (void)
\item 
void \hyperlink{mcpwm_8h_adab2ce19bc6cbb9ea59523665612c39a}{mcpwm\+\_\+adc\+\_\+int\+\_\+handler} (void $\ast$p, uint32\+\_\+t flags)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
volatile uint16\+\_\+t \hyperlink{mcpwm_8h_a4b6f5d6b8377b04320967c8a3ae33c8c}{A\+D\+C\+\_\+\+Value} \mbox{[}$\,$\mbox{]}
\item 
volatile int \hyperlink{mcpwm_8h_a9891bb6ef7ae8af63a4199ca2b713089}{A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value} \mbox{[}$\,$\mbox{]}
\item 
volatile float \hyperlink{mcpwm_8h_a438be5fa1cc0a77752c7b8219b76de3c}{mcpwm\+\_\+detect\+\_\+currents} \mbox{[}$\,$\mbox{]}
\item 
volatile float \hyperlink{mcpwm_8h_a9e57d9387f870f861edf7d0b79ed94d5}{mcpwm\+\_\+detect\+\_\+voltages} \mbox{[}$\,$\mbox{]}
\item 
volatile float \hyperlink{mcpwm_8h_acef66d9057fc8993c6743f96058d0246}{mcpwm\+\_\+detect\+\_\+currents\+\_\+diff} \mbox{[}$\,$\mbox{]}
\item 
volatile int \hyperlink{mcpwm_8h_aa2e911423c3781dd1296002d54bf0fa0}{mcpwm\+\_\+vzero}
\end{DoxyCompactItemize}


\subsection{Macro Definition Documentation}
\hypertarget{mcpwm_8h_a9fe34dbe691b4ee69ea087e40323c38c}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E@{M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}}
\index{M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E@{M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+C\+M\+D\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E~0}\label{mcpwm_8h_a9fe34dbe691b4ee69ea087e40323c38c}
\hypertarget{mcpwm_8h_af326efcbabf49b6657bdc53d4ebbf8a6}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S@{M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S}}
\index{M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S@{M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+D\+E\+A\+D\+\_\+\+T\+I\+M\+E\+\_\+\+C\+Y\+C\+L\+E\+S~100}\label{mcpwm_8h_af326efcbabf49b6657bdc53d4ebbf8a6}
\hypertarget{mcpwm_8h_a2b488809f7755e1f611e6f0635685c6d}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E@{M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}}
\index{M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E@{M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+D\+E\+T\+E\+C\+T\+\_\+\+S\+T\+O\+P\+\_\+\+T\+I\+M\+E~500}\label{mcpwm_8h_a2b488809f7755e1f611e6f0635685c6d}
\hypertarget{mcpwm_8h_aab2f67a9864fe0d38361b1a2264c4e3c}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K@{M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K}}
\index{M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K@{M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+P\+I\+D\+\_\+\+T\+I\+M\+E\+\_\+\+K~0.\+001}\label{mcpwm_8h_aab2f67a9864fe0d38361b1a2264c4e3c}
\hypertarget{mcpwm_8h_a9a916c035a72adb2b996c1c67250a867}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q@{M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q}}
\index{M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q@{M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+R\+P\+M\+\_\+\+T\+I\+M\+E\+R\+\_\+\+F\+R\+E\+Q~1000000.\+0}\label{mcpwm_8h_a9a916c035a72adb2b996c1c67250a867}
\hypertarget{mcpwm_8h_a1d7cc0d242a219aeefb8197fc4d6bbb1}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R}}
\index{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+D\+C\+\_\+\+M\+O\+T\+O\+R~25000}\label{mcpwm_8h_a1d7cc0d242a219aeefb8197fc4d6bbb1}
\hypertarget{mcpwm_8h_a220210c9d8362e1006daacf083302ac6}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X}}
\index{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+A\+X~40000}\label{mcpwm_8h_a220210c9d8362e1006daacf083302ac6}
\hypertarget{mcpwm_8h_a0d1206613a23135d2ad67c961fcd86a8}{}\index{mcpwm.\+h@{mcpwm.\+h}!M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N}}
\index{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N@{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N}]{\setlength{\rightskip}{0pt plus 5cm}\#define M\+C\+P\+W\+M\+\_\+\+S\+W\+I\+T\+C\+H\+\_\+\+F\+R\+E\+Q\+U\+E\+N\+C\+Y\+\_\+\+M\+I\+N~3000}\label{mcpwm_8h_a0d1206613a23135d2ad67c961fcd86a8}


\subsection{Function Documentation}
\hypertarget{mcpwm_8h_a472294b4fc68a52694b3b2751a473b96}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler@{mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler}}
\index{mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler@{mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+adc\+\_\+inj\+\_\+int\+\_\+handler (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a472294b4fc68a52694b3b2751a473b96}
\hypertarget{mcpwm_8h_adab2ce19bc6cbb9ea59523665612c39a}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+adc\+\_\+int\+\_\+handler@{mcpwm\+\_\+adc\+\_\+int\+\_\+handler}}
\index{mcpwm\+\_\+adc\+\_\+int\+\_\+handler@{mcpwm\+\_\+adc\+\_\+int\+\_\+handler}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+adc\+\_\+int\+\_\+handler(void $\ast$p, uint32\+\_\+t flags)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+adc\+\_\+int\+\_\+handler (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{p, }
\item[{uint32\+\_\+t}]{flags}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_adab2ce19bc6cbb9ea59523665612c39a}
\hypertarget{mcpwm_8h_a059e73c08f17b8f9c0f367903f9d5c0b}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+brake\+\_\+now@{mcpwm\+\_\+brake\+\_\+now}}
\index{mcpwm\+\_\+brake\+\_\+now@{mcpwm\+\_\+brake\+\_\+now}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+brake\+\_\+now(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+brake\+\_\+now (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a059e73c08f17b8f9c0f367903f9d5c0b}
Stop the motor and use braking. \hypertarget{mcpwm_8h_a7795f8c26fddcf448afa3d25623ae4e9}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+fault\+\_\+to\+\_\+string@{mcpwm\+\_\+fault\+\_\+to\+\_\+string}}
\index{mcpwm\+\_\+fault\+\_\+to\+\_\+string@{mcpwm\+\_\+fault\+\_\+to\+\_\+string}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+fault\+\_\+to\+\_\+string(mc\+\_\+fault\+\_\+code fault)}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ mcpwm\+\_\+fault\+\_\+to\+\_\+string (
\begin{DoxyParamCaption}
\item[{{\bf mc\+\_\+fault\+\_\+code}}]{fault}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a7795f8c26fddcf448afa3d25623ae4e9}
\hypertarget{mcpwm_8h_a2e52e42e3bf9eb9b3a6c20e234c35dd3}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+amp\+\_\+hours@{mcpwm\+\_\+get\+\_\+amp\+\_\+hours}}
\index{mcpwm\+\_\+get\+\_\+amp\+\_\+hours@{mcpwm\+\_\+get\+\_\+amp\+\_\+hours}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+amp\+\_\+hours(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+amp\+\_\+hours (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a2e52e42e3bf9eb9b3a6c20e234c35dd3}
Get the amount of amp hours drawn from the input source.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The amount of amp hours drawn. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_ab6138c5d1ee524398afef60eb74b6572}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged@{mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged}}
\index{mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged@{mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+amp\+\_\+hours\+\_\+charged (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ab6138c5d1ee524398afef60eb74b6572}
Get the amount of amp hours fed back into the input source.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The amount of amp hours fed back. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a7ebe7d5c7ed7ac5f336aab186a23377f}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+comm\+\_\+mode@{mcpwm\+\_\+get\+\_\+comm\+\_\+mode}}
\index{mcpwm\+\_\+get\+\_\+comm\+\_\+mode@{mcpwm\+\_\+get\+\_\+comm\+\_\+mode}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+comm\+\_\+mode(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf mc\+\_\+comm\+\_\+mode} mcpwm\+\_\+get\+\_\+comm\+\_\+mode (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a7ebe7d5c7ed7ac5f336aab186a23377f}
\hypertarget{mcpwm_8h_ad2acaf5174aa1f04744dd0b2355cfe9c}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+comm\+\_\+step@{mcpwm\+\_\+get\+\_\+comm\+\_\+step}}
\index{mcpwm\+\_\+get\+\_\+comm\+\_\+step@{mcpwm\+\_\+get\+\_\+comm\+\_\+step}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+comm\+\_\+step(void)}]{\setlength{\rightskip}{0pt plus 5cm}int mcpwm\+\_\+get\+\_\+comm\+\_\+step (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ad2acaf5174aa1f04744dd0b2355cfe9c}
Get the electrical position (or commutation step) of the motor.

\begin{DoxyReturn}{Returns}
The current commutation step. Range \mbox{[}1 6\mbox{]} 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a6a5d94aa8dfe85c2e2eb8bcedc4cc9e2}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+configuration@{mcpwm\+\_\+get\+\_\+configuration}}
\index{mcpwm\+\_\+get\+\_\+configuration@{mcpwm\+\_\+get\+\_\+configuration}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+configuration(void)}]{\setlength{\rightskip}{0pt plus 5cm}const volatile {\bf mc\+\_\+configuration}$\ast$ mcpwm\+\_\+get\+\_\+configuration (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a6a5d94aa8dfe85c2e2eb8bcedc4cc9e2}
\hypertarget{mcpwm_8h_a75eba9ba5161ac581ad23fe0718de72e}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+detect\+\_\+pos@{mcpwm\+\_\+get\+\_\+detect\+\_\+pos}}
\index{mcpwm\+\_\+get\+\_\+detect\+\_\+pos@{mcpwm\+\_\+get\+\_\+detect\+\_\+pos}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+detect\+\_\+pos(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+detect\+\_\+pos (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a75eba9ba5161ac581ad23fe0718de72e}
\hypertarget{mcpwm_8h_a055e8c23ee46051aa3e9c8eb5a62da31}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now@{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now}}
\index{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now@{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+now (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a055e8c23ee46051aa3e9c8eb5a62da31}
\hypertarget{mcpwm_8h_abf9e2e82ba6197cccca4980be9d82e86}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set@{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set}}
\index{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set@{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+duty\+\_\+cycle\+\_\+set (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_abf9e2e82ba6197cccca4980be9d82e86}
\hypertarget{mcpwm_8h_a543e86f6faec79974352738009a9da40}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+fault@{mcpwm\+\_\+get\+\_\+fault}}
\index{mcpwm\+\_\+get\+\_\+fault@{mcpwm\+\_\+get\+\_\+fault}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+fault(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf mc\+\_\+fault\+\_\+code} mcpwm\+\_\+get\+\_\+fault (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a543e86f6faec79974352738009a9da40}
\hypertarget{mcpwm_8h_aa5c97caf8a3c2a33986a77a39d32f88f}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result@{mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result}}
\index{mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result@{mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result(int8\+\_\+t $\ast$table)}]{\setlength{\rightskip}{0pt plus 5cm}int mcpwm\+\_\+get\+\_\+hall\+\_\+detect\+\_\+result (
\begin{DoxyParamCaption}
\item[{int8\+\_\+t $\ast$}]{table}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_aa5c97caf8a3c2a33986a77a39d32f88f}
Get the current detected hall sensor table


\begin{DoxyParams}{Parameters}
{\em table} & Pointer to a table where the result should be stored\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0\+: O\+K -\/1\+: Invalid hall sensor output -\/2\+: W\+S2811 enabled -\/3\+: Encoder enabled 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a2755a29a5e5899b14bf3a8885cee5fad}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+kv@{mcpwm\+\_\+get\+\_\+kv}}
\index{mcpwm\+\_\+get\+\_\+kv@{mcpwm\+\_\+get\+\_\+kv}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+kv(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+kv (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a2755a29a5e5899b14bf3a8885cee5fad}
Calculate the K\+V (R\+P\+M per volt) value for the motor. This function has to be used while the motor is moving. Note that the return value has to be divided by half the number of motor poles.

\begin{DoxyReturn}{Returns}
The K\+V value. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a381642f17c64e43bc0d1ee711dcf65eb}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+kv\+\_\+filtered@{mcpwm\+\_\+get\+\_\+kv\+\_\+filtered}}
\index{mcpwm\+\_\+get\+\_\+kv\+\_\+filtered@{mcpwm\+\_\+get\+\_\+kv\+\_\+filtered}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+kv\+\_\+filtered(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+kv\+\_\+filtered (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a381642f17c64e43bc0d1ee711dcf65eb}
Calculate the F\+I\+R-\/filtered K\+V (R\+P\+M per volt) value for the motor. This function has to be used while the motor is moving. Note that the return value has to be divided by half the number of motor poles.

\begin{DoxyReturn}{Returns}
The filtered K\+V value. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_ad04a5f41ac3b2dbdff88e925f5a7c867}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration@{mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration}}
\index{mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration@{mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+last\+\_\+adc\+\_\+isr\+\_\+duration (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ad04a5f41ac3b2dbdff88e925f5a7c867}
\hypertarget{mcpwm_8h_afbf59470d2a43800159793dcf9a2fa1c}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration@{mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration}}
\index{mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration@{mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+last\+\_\+inj\+\_\+adc\+\_\+isr\+\_\+duration (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_afbf59470d2a43800159793dcf9a2fa1c}
\hypertarget{mcpwm_8h_a40f44eb9a9076013bedd753a31e8ca01}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+min\+\_\+rpm@{mcpwm\+\_\+get\+\_\+min\+\_\+rpm}}
\index{mcpwm\+\_\+get\+\_\+min\+\_\+rpm@{mcpwm\+\_\+get\+\_\+min\+\_\+rpm}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+min\+\_\+rpm(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+min\+\_\+rpm (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a40f44eb9a9076013bedd753a31e8ca01}
Get the minimum allowed R\+P\+M in sensorless mode.

\begin{DoxyReturn}{Returns}
The minimum allowed R\+P\+M. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_aa48e2f10a4519f28a8cedf114ddd39fa}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+rpm@{mcpwm\+\_\+get\+\_\+rpm}}
\index{mcpwm\+\_\+get\+\_\+rpm@{mcpwm\+\_\+get\+\_\+rpm}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+rpm(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+rpm (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_aa48e2f10a4519f28a8cedf114ddd39fa}
Calculate the current R\+P\+M of the motor. This is a signed value and the sign depends on the direction the motor is rotating in. Note that this value has to be divided by half the number of motor poles.

\begin{DoxyReturn}{Returns}
The R\+P\+M value. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a3e00de142622d9a94d6ff0711850c0e9}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+rpm\+\_\+dep@{mcpwm\+\_\+get\+\_\+rpm\+\_\+dep}}
\index{mcpwm\+\_\+get\+\_\+rpm\+\_\+dep@{mcpwm\+\_\+get\+\_\+rpm\+\_\+dep}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+rpm\+\_\+dep(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf mc\+\_\+rpm\+\_\+dep\+\_\+struct} mcpwm\+\_\+get\+\_\+rpm\+\_\+dep (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a3e00de142622d9a94d6ff0711850c0e9}
\hypertarget{mcpwm_8h_a877cbb1f32dab9cc76d8aad64b2aa1ed}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+state@{mcpwm\+\_\+get\+\_\+state}}
\index{mcpwm\+\_\+get\+\_\+state@{mcpwm\+\_\+get\+\_\+state}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+state(void)}]{\setlength{\rightskip}{0pt plus 5cm}{\bf mc\+\_\+state} mcpwm\+\_\+get\+\_\+state (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a877cbb1f32dab9cc76d8aad64b2aa1ed}
\hypertarget{mcpwm_8h_a2c11fd7cd576b8545639d70ad9068bb6}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now@{mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now}}
\index{mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now@{mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+switching\+\_\+frequency\+\_\+now (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a2c11fd7cd576b8545639d70ad9068bb6}
Get the current switching frequency.

\begin{DoxyReturn}{Returns}
The switching frequency in Hz. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a669cef28cf150b9bb377db52bf38f3aa}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value@{mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value}}
\index{mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value@{mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}int mcpwm\+\_\+get\+\_\+tachometer\+\_\+abs\+\_\+value (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a669cef28cf150b9bb377db52bf38f3aa}
Read the absolute number of steps the motor has rotated.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the tachometer counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The tachometer value in motor steps. The number of motor revolutions will be this number divided by (3 $\ast$ M\+O\+T\+O\+R\+\_\+\+P\+O\+L\+E\+\_\+\+N\+U\+M\+B\+E\+R). 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a095a677c5faec19ad0e58cf18a371c1f}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tachometer\+\_\+value@{mcpwm\+\_\+get\+\_\+tachometer\+\_\+value}}
\index{mcpwm\+\_\+get\+\_\+tachometer\+\_\+value@{mcpwm\+\_\+get\+\_\+tachometer\+\_\+value}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tachometer\+\_\+value(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}int mcpwm\+\_\+get\+\_\+tachometer\+\_\+value (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a095a677c5faec19ad0e58cf18a371c1f}
Read the number of steps the motor has rotated. This number is signed and will return a negative number when the motor is rotating backwards.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the tachometer counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The tachometer value in motor steps. The number of motor revolutions will be this number divided by (3 $\ast$ M\+O\+T\+O\+R\+\_\+\+P\+O\+L\+E\+\_\+\+N\+U\+M\+B\+E\+R). 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a62cdbf8a4a38b8537d93c6bd1c01b91e}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current@{mcpwm\+\_\+get\+\_\+tot\+\_\+current}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current@{mcpwm\+\_\+get\+\_\+tot\+\_\+current}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a62cdbf8a4a38b8537d93c6bd1c01b91e}
Get the motor current. The sign of this value will represent whether the motor is drawing (positive) or generating (negative) current.

\begin{DoxyReturn}{Returns}
The motor current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_ac0b77e746e9a92a419d6114997fbd763}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ac0b77e746e9a92a419d6114997fbd763}
Get the motor current. The sign of this value represents the direction in which the motor generates torque.

\begin{DoxyReturn}{Returns}
The motor current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a2a2c6e557a045f7e70a177aeb9e6268b}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+directional\+\_\+filtered (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a2a2c6e557a045f7e70a177aeb9e6268b}
Get the filtered motor current. The sign of this value represents the direction in which the motor generates torque.

\begin{DoxyReturn}{Returns}
The filtered motor current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a15bd545876cc438ccafe772971305f18}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+filtered (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a15bd545876cc438ccafe772971305f18}
Get the F\+I\+R-\/filtered motor current. The sign of this value will represent whether the motor is drawing (positive) or generating (negative) current.

\begin{DoxyReturn}{Returns}
The filtered motor current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a5a07d303d2dbeeb7d406031ec0245768}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a5a07d303d2dbeeb7d406031ec0245768}
Get the input current to the motor controller.

\begin{DoxyReturn}{Returns}
The input current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a632b1e9f636f0e2dae31ae45704ad5ce}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered}}
\index{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered@{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+tot\+\_\+current\+\_\+in\+\_\+filtered (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a632b1e9f636f0e2dae31ae45704ad5ce}
Get the F\+I\+R-\/filtered input current to the motor controller.

\begin{DoxyReturn}{Returns}
The filtered input current. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a6528d34554fe5f88bac0a7c04c26d6f8}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+watt\+\_\+hours@{mcpwm\+\_\+get\+\_\+watt\+\_\+hours}}
\index{mcpwm\+\_\+get\+\_\+watt\+\_\+hours@{mcpwm\+\_\+get\+\_\+watt\+\_\+hours}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+watt\+\_\+hours(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+watt\+\_\+hours (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a6528d34554fe5f88bac0a7c04c26d6f8}
Get the amount of watt hours drawn from the input source.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The amount of watt hours drawn. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a0a8f41dcfa397ba1197e9cd139f391b4}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged@{mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged}}
\index{mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged@{mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged(bool reset)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+get\+\_\+watt\+\_\+hours\+\_\+charged (
\begin{DoxyParamCaption}
\item[{bool}]{reset}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a0a8f41dcfa397ba1197e9cd139f391b4}
Get the amount of watt hours fed back into the input source.


\begin{DoxyParams}{Parameters}
{\em reset} & If true, the counter will be reset after this call.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The amount of watt hours fed back. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_a741df16681b89fa88b1dfdc148e9c247}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+init@{mcpwm\+\_\+init}}
\index{mcpwm\+\_\+init@{mcpwm\+\_\+init}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+init(mc\+\_\+configuration $\ast$configuration)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf mc\+\_\+configuration} $\ast$}]{configuration}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a741df16681b89fa88b1dfdc148e9c247}
\hypertarget{mcpwm_8h_ab0ded721a702fcc2f419e348dfb2394e}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+init\+\_\+hall\+\_\+table@{mcpwm\+\_\+init\+\_\+hall\+\_\+table}}
\index{mcpwm\+\_\+init\+\_\+hall\+\_\+table@{mcpwm\+\_\+init\+\_\+hall\+\_\+table}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+init\+\_\+hall\+\_\+table(int8\+\_\+t $\ast$table)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+init\+\_\+hall\+\_\+table (
\begin{DoxyParamCaption}
\item[{int8\+\_\+t $\ast$}]{table}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ab0ded721a702fcc2f419e348dfb2394e}
Initialize the hall sensor lookup table


\begin{DoxyParams}{Parameters}
{\em table} & The commutations corresponding to the hall sensor states in the forward direction-\/ \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_a950110bbb0c5db30530775f3ad8c7c8f}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+lock@{mcpwm\+\_\+lock}}
\index{mcpwm\+\_\+lock@{mcpwm\+\_\+lock}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+lock(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+lock (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a950110bbb0c5db30530775f3ad8c7c8f}
Lock the control by disabling all control commands. \hypertarget{mcpwm_8h_a01ee78893a848db2a0a265d85516d89d}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+lock\+\_\+override\+\_\+once@{mcpwm\+\_\+lock\+\_\+override\+\_\+once}}
\index{mcpwm\+\_\+lock\+\_\+override\+\_\+once@{mcpwm\+\_\+lock\+\_\+override\+\_\+once}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+lock\+\_\+override\+\_\+once(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+lock\+\_\+override\+\_\+once (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a01ee78893a848db2a0a265d85516d89d}
Allow just one motor control command in the locked state. \hypertarget{mcpwm_8h_af3c4d35168fdd37ace78e17350785ff9}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+read\+\_\+hall\+\_\+phase@{mcpwm\+\_\+read\+\_\+hall\+\_\+phase}}
\index{mcpwm\+\_\+read\+\_\+hall\+\_\+phase@{mcpwm\+\_\+read\+\_\+hall\+\_\+phase}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+read\+\_\+hall\+\_\+phase(void)}]{\setlength{\rightskip}{0pt plus 5cm}int mcpwm\+\_\+read\+\_\+hall\+\_\+phase (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_af3c4d35168fdd37ace78e17350785ff9}
Read the current phase of the motor using hall effect sensors \begin{DoxyReturn}{Returns}
The phase read. 
\end{DoxyReturn}
\hypertarget{mcpwm_8h_aecc8d955f57997ec6ddb37d9923c1030}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator}}
\index{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+cycle\+\_\+integrator (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_aecc8d955f57997ec6ddb37d9923c1030}
\hypertarget{mcpwm_8h_a6e658badc7694a6fd3b20c66b42efeb8}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current}}
\index{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+input\+\_\+current (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a6e658badc7694a6fd3b20c66b42efeb8}
\hypertarget{mcpwm_8h_af291b09431a336394d37f9faeca78263}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current}}
\index{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current@{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current(void)}]{\setlength{\rightskip}{0pt plus 5cm}float mcpwm\+\_\+read\+\_\+reset\+\_\+avg\+\_\+motor\+\_\+current (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_af291b09431a336394d37f9faeca78263}
\hypertarget{mcpwm_8h_a060e6f8cceedc217d4cda3dc7e255acb}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+release\+\_\+motor@{mcpwm\+\_\+release\+\_\+motor}}
\index{mcpwm\+\_\+release\+\_\+motor@{mcpwm\+\_\+release\+\_\+motor}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+release\+\_\+motor(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+release\+\_\+motor (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a060e6f8cceedc217d4cda3dc7e255acb}
Disconnect the motor and let it turn freely. \hypertarget{mcpwm_8h_a811f97662c12f6c6f6db2d3ef653317e}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table@{mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table}}
\index{mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table@{mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+reset\+\_\+hall\+\_\+detect\+\_\+table (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a811f97662c12f6c6f6db2d3ef653317e}
Reset the hall sensor detection table \hypertarget{mcpwm_8h_af5a0f5ec4944da39e9192d1fee78c5ad}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+brake\+\_\+current@{mcpwm\+\_\+set\+\_\+brake\+\_\+current}}
\index{mcpwm\+\_\+set\+\_\+brake\+\_\+current@{mcpwm\+\_\+set\+\_\+brake\+\_\+current}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+brake\+\_\+current(float current)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+brake\+\_\+current (
\begin{DoxyParamCaption}
\item[{float}]{current}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_af5a0f5ec4944da39e9192d1fee78c5ad}
Brake the motor with a desired current. Absolute values less than conf.\+cc\+\_\+min\+\_\+current will release the motor.


\begin{DoxyParams}{Parameters}
{\em current} & The current to use. Positive and negative values give the same effect. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_adf1422a651e069f04434c76fd359f5d7}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+comm\+\_\+mode@{mcpwm\+\_\+set\+\_\+comm\+\_\+mode}}
\index{mcpwm\+\_\+set\+\_\+comm\+\_\+mode@{mcpwm\+\_\+set\+\_\+comm\+\_\+mode}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+comm\+\_\+mode(mc\+\_\+comm\+\_\+mode mode)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+comm\+\_\+mode (
\begin{DoxyParamCaption}
\item[{{\bf mc\+\_\+comm\+\_\+mode}}]{mode}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_adf1422a651e069f04434c76fd359f5d7}
Set the commutation mode for sensorless commutation.


\begin{DoxyParams}{Parameters}
{\em mode} & C\+O\+M\+M\+\_\+\+M\+O\+D\+E\+\_\+\+I\+N\+T\+E\+G\+R\+A\+T\+E\+: More robust, but requires many parameters. C\+O\+M\+M\+\_\+\+M\+O\+D\+E\+\_\+\+D\+E\+L\+A\+Y\+: Like most hobby E\+S\+Cs. Requires less parameters, but has worse startup and is less robust. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_af0c84721a6bd9e03bcdc83997dceb0bd}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+configuration@{mcpwm\+\_\+set\+\_\+configuration}}
\index{mcpwm\+\_\+set\+\_\+configuration@{mcpwm\+\_\+set\+\_\+configuration}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+configuration(mc\+\_\+configuration $\ast$configuration)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+configuration (
\begin{DoxyParamCaption}
\item[{{\bf mc\+\_\+configuration} $\ast$}]{configuration}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_af0c84721a6bd9e03bcdc83997dceb0bd}
\hypertarget{mcpwm_8h_ac8cce9e7089ba5b002f4bf38211ed27a}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+current@{mcpwm\+\_\+set\+\_\+current}}
\index{mcpwm\+\_\+set\+\_\+current@{mcpwm\+\_\+set\+\_\+current}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+current(float current)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+current (
\begin{DoxyParamCaption}
\item[{float}]{current}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ac8cce9e7089ba5b002f4bf38211ed27a}
Use current control and specify a goal current to use. The sign determines the direction of the torque. Absolute values less than conf.\+cc\+\_\+min\+\_\+current will release the motor.


\begin{DoxyParams}{Parameters}
{\em current} & The current to use. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_aee80954eb251a3cc7e3cbd9e2d72ad50}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+detect@{mcpwm\+\_\+set\+\_\+detect}}
\index{mcpwm\+\_\+set\+\_\+detect@{mcpwm\+\_\+set\+\_\+detect}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+detect(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+detect (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_aee80954eb251a3cc7e3cbd9e2d72ad50}
\hypertarget{mcpwm_8h_a9dd57224b5a0906f51f63deb04575fda}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+duty@{mcpwm\+\_\+set\+\_\+duty}}
\index{mcpwm\+\_\+set\+\_\+duty@{mcpwm\+\_\+set\+\_\+duty}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+duty(float duty\+Cycle)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+duty (
\begin{DoxyParamCaption}
\item[{float}]{duty\+Cycle}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a9dd57224b5a0906f51f63deb04575fda}
Use duty cycle control. Absolute values less than M\+C\+P\+W\+M\+\_\+\+M\+I\+N\+\_\+\+D\+U\+T\+Y\+\_\+\+C\+Y\+C\+L\+E will stop the motor.


\begin{DoxyParams}{Parameters}
{\em duty\+Cycle} & The duty cycle to use. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_a56298b9a210017fcdf9eb982de492a80}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+min\+\_\+rpm@{mcpwm\+\_\+set\+\_\+min\+\_\+rpm}}
\index{mcpwm\+\_\+set\+\_\+min\+\_\+rpm@{mcpwm\+\_\+set\+\_\+min\+\_\+rpm}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+min\+\_\+rpm(float rpm)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+min\+\_\+rpm (
\begin{DoxyParamCaption}
\item[{float}]{rpm}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a56298b9a210017fcdf9eb982de492a80}
Set the minimum allowed R\+P\+M in sensorless mode. This will affect startup performance. W\+A\+R\+N\+I\+N\+G\+: Setting this too high can break stuff.


\begin{DoxyParams}{Parameters}
{\em rpm} & The minimum allowed R\+P\+M. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_a947be2c19679b5d18b593fd43b3bbc5f}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+pid\+\_\+pos@{mcpwm\+\_\+set\+\_\+pid\+\_\+pos}}
\index{mcpwm\+\_\+set\+\_\+pid\+\_\+pos@{mcpwm\+\_\+set\+\_\+pid\+\_\+pos}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+pid\+\_\+pos(float pos)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+pid\+\_\+pos (
\begin{DoxyParamCaption}
\item[{float}]{pos}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a947be2c19679b5d18b593fd43b3bbc5f}
Use P\+I\+D position control. Note that this only works when encoder support is enabled.


\begin{DoxyParams}{Parameters}
{\em pos} & The desired position of the motor in degrees. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_ac0ea3c433002e0c6152f1e8c336ea773}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+set\+\_\+pid\+\_\+speed@{mcpwm\+\_\+set\+\_\+pid\+\_\+speed}}
\index{mcpwm\+\_\+set\+\_\+pid\+\_\+speed@{mcpwm\+\_\+set\+\_\+pid\+\_\+speed}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+set\+\_\+pid\+\_\+speed(float rpm)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+set\+\_\+pid\+\_\+speed (
\begin{DoxyParamCaption}
\item[{float}]{rpm}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_ac0ea3c433002e0c6152f1e8c336ea773}
Use P\+I\+D rpm control. Note that this value has to be multiplied by half of the number of motor poles.


\begin{DoxyParams}{Parameters}
{\em rpm} & The electrical R\+P\+M goal value to use. \\
\hline
\end{DoxyParams}
\hypertarget{mcpwm_8h_a9833abbb75ecaec36ea2f2ae6afa14e3}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+unlock@{mcpwm\+\_\+unlock}}
\index{mcpwm\+\_\+unlock@{mcpwm\+\_\+unlock}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+unlock(void)}]{\setlength{\rightskip}{0pt plus 5cm}void mcpwm\+\_\+unlock (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{mcpwm_8h_a9833abbb75ecaec36ea2f2ae6afa14e3}
Unlock all control commands. 

\subsection{Variable Documentation}
\hypertarget{mcpwm_8h_a9891bb6ef7ae8af63a4199ca2b713089}{}\index{mcpwm.\+h@{mcpwm.\+h}!A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value@{A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value}}
\index{A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value@{A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value}]{\setlength{\rightskip}{0pt plus 5cm}volatile int A\+D\+C\+\_\+curr\+\_\+norm\+\_\+value\mbox{[}$\,$\mbox{]}}\label{mcpwm_8h_a9891bb6ef7ae8af63a4199ca2b713089}
\hypertarget{mcpwm_8h_a4b6f5d6b8377b04320967c8a3ae33c8c}{}\index{mcpwm.\+h@{mcpwm.\+h}!A\+D\+C\+\_\+\+Value@{A\+D\+C\+\_\+\+Value}}
\index{A\+D\+C\+\_\+\+Value@{A\+D\+C\+\_\+\+Value}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{A\+D\+C\+\_\+\+Value}]{\setlength{\rightskip}{0pt plus 5cm}volatile uint16\+\_\+t A\+D\+C\+\_\+\+Value\mbox{[}$\,$\mbox{]}}\label{mcpwm_8h_a4b6f5d6b8377b04320967c8a3ae33c8c}
\hypertarget{mcpwm_8h_a438be5fa1cc0a77752c7b8219b76de3c}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+detect\+\_\+currents@{mcpwm\+\_\+detect\+\_\+currents}}
\index{mcpwm\+\_\+detect\+\_\+currents@{mcpwm\+\_\+detect\+\_\+currents}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+detect\+\_\+currents}]{\setlength{\rightskip}{0pt plus 5cm}volatile float mcpwm\+\_\+detect\+\_\+currents\mbox{[}$\,$\mbox{]}}\label{mcpwm_8h_a438be5fa1cc0a77752c7b8219b76de3c}
\hypertarget{mcpwm_8h_acef66d9057fc8993c6743f96058d0246}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+detect\+\_\+currents\+\_\+diff@{mcpwm\+\_\+detect\+\_\+currents\+\_\+diff}}
\index{mcpwm\+\_\+detect\+\_\+currents\+\_\+diff@{mcpwm\+\_\+detect\+\_\+currents\+\_\+diff}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+detect\+\_\+currents\+\_\+diff}]{\setlength{\rightskip}{0pt plus 5cm}volatile float mcpwm\+\_\+detect\+\_\+currents\+\_\+diff\mbox{[}$\,$\mbox{]}}\label{mcpwm_8h_acef66d9057fc8993c6743f96058d0246}
\hypertarget{mcpwm_8h_a9e57d9387f870f861edf7d0b79ed94d5}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+detect\+\_\+voltages@{mcpwm\+\_\+detect\+\_\+voltages}}
\index{mcpwm\+\_\+detect\+\_\+voltages@{mcpwm\+\_\+detect\+\_\+voltages}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+detect\+\_\+voltages}]{\setlength{\rightskip}{0pt plus 5cm}volatile float mcpwm\+\_\+detect\+\_\+voltages\mbox{[}$\,$\mbox{]}}\label{mcpwm_8h_a9e57d9387f870f861edf7d0b79ed94d5}
\hypertarget{mcpwm_8h_aa2e911423c3781dd1296002d54bf0fa0}{}\index{mcpwm.\+h@{mcpwm.\+h}!mcpwm\+\_\+vzero@{mcpwm\+\_\+vzero}}
\index{mcpwm\+\_\+vzero@{mcpwm\+\_\+vzero}!mcpwm.\+h@{mcpwm.\+h}}
\subsubsection[{mcpwm\+\_\+vzero}]{\setlength{\rightskip}{0pt plus 5cm}volatile int mcpwm\+\_\+vzero}\label{mcpwm_8h_aa2e911423c3781dd1296002d54bf0fa0}
